home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / dev / gui / gtlayout.lha / Source / LT_SetAttributes.c < prev    next >
C/C++ Source or Header  |  1999-01-03  |  34KB  |  1,573 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1999 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. /*****************************************************************************/
  15.  
  16. #include <stdarg.h>
  17.  
  18. /*****************************************************************************/
  19.  
  20. #include "Assert.h"
  21.  
  22. /*****************************************************************************/
  23.  
  24. VOID
  25. LT_SetAttributes(LayoutHandle *handle,LONG id,...)
  26. {
  27.     va_list VarArgs;
  28.  
  29.     va_start(VarArgs,id);
  30.     LT_SetAttributesA(handle,id,(struct TagItem *)VarArgs);
  31.     va_end(VarArgs);
  32. }
  33.  
  34.  
  35. /*****************************************************************************/
  36.  
  37.  
  38. VOID
  39. LTP_AddAllAndRefreshThisGadget(LayoutHandle *Handle,struct Gadget *Gadget)
  40. {
  41.     AddGList(Handle->Window,Handle->List,(UWORD)-1,(UWORD)-1,NULL);
  42.     RefreshGList(Gadget,Handle->Window,NULL,1);
  43. }
  44.  
  45. VOID
  46. LTP_FixState(LayoutHandle *Handle,BOOL State,struct Gadget *Gadget,UWORD Bit)
  47. {
  48.     if(Gadget)
  49.     {
  50.         LTP_StripGadgets(Handle,Handle->List);
  51.  
  52.         if(State)
  53.             Gadget->Flags |=  Bit;
  54.         else
  55.             Gadget->Flags &= ~Bit;
  56.  
  57.         LTP_AddAllAndRefreshThisGadget(Handle,Gadget);
  58.     }
  59. }
  60.  
  61. BOOL
  62. LTP_NotifyPager(LayoutHandle *Handle,LONG ID,LONG Page)
  63. {
  64.     if(ID != -1)
  65.     {
  66.         LT_SetAttributes(Handle,ID,
  67.             LAGR_ActivePage,Page,
  68.         TAG_DONE);
  69.  
  70.         if(Handle->Failed)
  71.             return(FALSE);
  72.     }
  73.  
  74.     return(TRUE);
  75. }
  76.  
  77.  
  78. /*****************************************************************************/
  79.  
  80.  
  81. /****** gtlayout.library/LT_SetAttributesA ******************************************
  82. *
  83. *   NAME
  84. *    LT_SetAttributesA -- Change object attributes
  85. *
  86. *   SYNOPSIS
  87. *    LT_SetAttributesA(Handle,ID,Tags);
  88. *                        A0   D0  A1
  89. *
  90. *    VOID LT_SetAttributes(LayoutHandle *,LONG,struct TagItem *);
  91. *
  92. *    LT_SetAttributes(Handle,ID,...);
  93. *
  94. *    VOID LT_SetAttributes(LayoutHandle *,LONG,...);
  95. *
  96. *   FUNCTION
  97. *    This routine passes the tag item list it gets directly
  98. *    over to GT_SetGadgetAttrsA(), so any tag items valid for
  99. *    gadtools.library can be used here as well. Some filtering
  100. *    may be done in order to stop objects from getting redrawn
  101. *    if this is not absolutely necessary.
  102. *
  103. *   INPUTS
  104. *    Handle - Pointer to LayoutHandle.
  105. *
  106. *    ID - ID number of the object to change. This is the same value
  107. *        you passed via LA_ID to LT_New() when you created this object.
  108. *
  109. *    Tags - Attributes controlling object states.
  110. *
  111. *
  112. *    All gadtools.library tags are allowed, but not all are supported.
  113. *    In addition to these tags a few additional tag values are
  114. *    supported:
  115. *
  116. *    LAHN_AutoActivate (BOOL) - Set to TRUE if you want the interface
  117. *        to always keep a string gadget active if possible. Hitting
  118. *        the return key will then cause the next following string
  119. *        gadget to get activated, either cycling through all the
  120. *        string gadgets available or stopping at the next string
  121. *        gadget to have the LAST_LastGadget attribute set.
  122. *
  123. *    LAHN_UserData (APTR) - Store user specific data in the
  124. *        LayoutHandle->UserData entry. (V9)
  125. *
  126. *    LAHN_RawKeyFilter (BOOL) - Discard unprocessed IDCMP_RAWKEY
  127. *        events. (V13)
  128. *        Default: TRUE
  129. *
  130. *    LAHN_LocaleHook (struct Hook *) - The hook to call when
  131. *        locale string IDs are to be mapped to strings. The
  132. *        hook function is called with the following parameters:
  133. *
  134. *        String = HookFunc(struct Hook *Hook,struct LayoutHandle *Handle,
  135. *          D0                            A0                         A2
  136. *                          LONG ID)
  137. *                               A1
  138. *
  139. *        The function is to look up the string associated with the ID
  140. *        passed in and return the string.
  141. *
  142. *    LAHN_ExitFlush (BOOL) - When the LayoutHandle is finally disposed
  143. *        of with LT_DeleteHandle() all variables maintained by the
  144. *        input handling code will be flushed. For example, if you
  145. *        would use the LA_STRPTR tag for STRING_KIND objects the
  146. *        last string gadget contents would be copied into the buffer
  147. *        pointed to by LA_STRPTR. If you do not want to use this
  148. *        feature, disable it with "LAHN_ExitFlush,FALSE". (V9)
  149. *        Default: TRUE
  150. *
  151. *    GAUGE_KIND:
  152. *
  153. *        LAGA_Percent (LONG) - Percentage of the gauge to fill.
  154. *
  155. *        LAGA_InfoText (STRPTR) - Text to be printed within the
  156. *            gauge display, such as a percentage number.
  157. *
  158. *    BOX_KIND:
  159. *
  160. *        LABX_Index (LONG) - The number of the line to change, this
  161. *            tag works in conjunction with the LABX_Text tag.
  162. *
  163. *        LABX_Text (STRPTR) - The text to put into the line indicated
  164. *            by the LABX_Index tag.
  165. *            As of v26 the LABX_Index tag may be omitted, the library
  166. *            will then assume the line index will be 0.
  167. *
  168. *        LABX_Lines (STRPTR *) - The text to set for the box contents,
  169. *            terminate the text array with NULL.
  170. *
  171. *    HORIZONTAL_KIND:
  172. *    VERTICAL_KIND:
  173. *
  174. *        LAGR_ActivePage (LONG) - Index number of page to display
  175. *            within the group.
  176. *
  177. *                NOTE: requires that this group was created
  178. *                    with the LAGR_ActivePage attribute set.
  179. *
  180. *    INTEGER_KIND:
  181. *
  182. *        LAIN_Min (LONG) - Minimum allowed value for this
  183. *            object.
  184. *
  185. *        LAIN_Max (LONG) - Maximum allowed value for this
  186. *            object.
  187. *
  188. *    LISTVIEW_KIND:
  189. *
  190. *        LALV_Selected (LONG) - Combines GTLV_Selected and
  191. *            GTLV_Top (for Kickstart V37) or GTLV_MakeVisible
  192. *            (for Kickstart V39 and greater). This means, the
  193. *            list display will be changed in order to show
  194. *            the item to be selected. (V34)
  195. *
  196. *    LEVEL_KIND:
  197. *
  198. *        LAVL_NumTicks (WORD) - Number of tick marks to draw
  199. *           next to the slider body.
  200. *
  201. *    PASSWORD_KIND:
  202. *
  203. *        LAPW_String (STRPTR) - Secret text to use
  204. *
  205. *    POPUP_KIND
  206. *
  207. *        LAPU_Labels (STRPTR *) - To block access to the popup
  208. *            menu, for example before you free the current list
  209. *            of labels, you can pass ~0 as the list parameter. (V25)
  210. *
  211. *    STRING_KIND:
  212. *
  213. *        LAST_CursorPosition (LONG) - Repositions the cursor,
  214. *            pass -1 to move it to the end of the string. (V7)
  215. *
  216. *    TAPEDECK_KIND:
  217. *
  218. *        LATD_Pressed (BOOL) - TRUE to make this button shown
  219. *            as pressed, FALSE to show it in depressed state.
  220. *
  221. *    BOOPSI_KIND:
  222. *
  223. *        All tags are passed straight through to SetGadgetAttrs(..).
  224. *
  225. *    TEXTEDIT_KIND:
  226. *
  227. *        LATE_String (STRPTR) - The string to put into the editing
  228. *            area.
  229. *
  230. *        LATE_CursorPosition (LONG) - Index number of the character
  231. *            to put the cursor on. Pass -1 to put it to the end
  232. *            of the string.
  233. *
  234. *    All objects:
  235. *
  236. *        LA_LabelText (STRPTR) - New gadget label text to use.
  237. *
  238. *        LA_LabelID (LONG) - Locale text ID to use for this object.
  239. *
  240. *   RESULT
  241. *    none
  242. *
  243. *   SEE ALSO
  244. *    gadtools.library/GT_SetGadgetAttrsA()
  245. *    intuition.library/SetGadgetAttrsA
  246. *
  247. ******************************************************************************
  248. *
  249. */
  250.  
  251. VOID LIBENT
  252. LT_SetAttributesA(REG(a0) LayoutHandle *handle,REG(d0) LONG id,REG(a1) struct TagItem *TagList)
  253. {
  254.     if(handle && TagList)
  255.     {
  256.         struct Gadget    *Gadget = NULL;
  257.         struct TagItem    *ThisTag,*ThisList = TagList;
  258.         ObjectNode        *Node = NULL;
  259.  
  260.         while(ThisTag = NextTagItem(&ThisList))
  261.         {
  262.             switch(ThisTag->ti_Tag)
  263.             {
  264.                 case LH_AutoActivate:
  265.  
  266.                     handle->AutoActivate = ThisTag->ti_Data;
  267.                     break;
  268.  
  269.                 case LH_RawKeyFilter:
  270.  
  271.                     handle->RawKeyFilter = ThisTag->ti_Data;
  272.                     break;
  273.  
  274.                 case LH_UserData:
  275.  
  276.                     handle->UserData = (APTR)ThisTag->ti_Data;
  277.                     break;
  278.  
  279.                 case LH_ExitFlush:
  280.  
  281.                     handle->ExitFlush = ThisTag->ti_Data;
  282.                     break;
  283.  
  284.                 case LH_LocaleHook:
  285.  
  286.                     handle->LocaleHook = (struct Hook *)ThisTag->ti_Data;
  287.                     break;
  288.  
  289.                 case LAPR_Gadget:
  290.  
  291.                     Gadget = (struct Gadget *)ThisTag->ti_Data;
  292.                     break;
  293.  
  294.                 case LAPR_Object:
  295.  
  296.                     Node = (ObjectNode *)ThisTag->ti_Data;
  297.                     break;
  298.             }
  299.         }
  300.  
  301.         if(Node)
  302.             Gadget = Node->Host;
  303.         else
  304.         {
  305.             if(Gadget)
  306.             {
  307.                 if(Node = (ObjectNode *)Gadget->UserData)
  308.                 {
  309.                     if(Node->Host != Gadget || Node->PointBack != Node)
  310.                         Node = NULL;
  311.                 }
  312.             }
  313.         }
  314.  
  315.         if(!Gadget)
  316.         {
  317.             if(Gadget = LTP_FindGadget(handle,id))
  318.             {
  319.                 if(Node = (ObjectNode *)Gadget->UserData)
  320.                 {
  321.                     if(Node->Host != Gadget || Node->PointBack != Node)
  322.                         Node = NULL;
  323.                 }
  324.             }
  325.             else
  326.                 Node = LTP_FindNode(handle,id);
  327.         }
  328.  
  329.         if(Node)
  330.         {
  331.             STATIC const Tag Filter[2] = { GA_Disabled,TAG_DONE };
  332.  
  333.             struct TagItem    *NewTags = NULL;
  334.             ULONG             Exclude = NULL;
  335.  
  336.             switch(Node->Type)
  337.             {
  338.                 #ifdef DO_PASSWORD_KIND
  339.                 {
  340.                     case PASSWORD_KIND:
  341.  
  342.                         if(ThisTag = FindTagItem(GTST_String,TagList))
  343.                         {
  344.                             STRPTR String;
  345.                             LONG Len;
  346.  
  347.                             String = (STRPTR)TagList->ti_Data;
  348.  
  349.                             if(String)
  350.                                 Len = strlen(String);
  351.                             else
  352.                             {
  353.                                 String = "";
  354.                                 Len = 0;
  355.                             }
  356.  
  357.                             Exclude = GTST_String;
  358.  
  359.                             strcpy(Node->Special.String.RealString,String);
  360.  
  361.                             if(Len)
  362.                             {
  363.                                 memset(Node->Special.String.Original,'·',Len);
  364.                                 Node->Special.String.Original[Len] = 0;
  365.                             }
  366.  
  367.                             GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  368.                                 GTST_String,Node->Special.String.Original,
  369.                             TAG_DONE);
  370.                         }
  371.  
  372.                         break;
  373.                 }
  374.                 #endif
  375.  
  376.                 #ifdef DO_BOOPSI_KIND
  377.                 {
  378.                     case BOOPSI_KIND:
  379.  
  380.                         if(ThisTag = FindTagItem(GA_Disabled,TagList))
  381.                             Node->Disabled = ThisTag->ti_Data;
  382.  
  383.                         if(Node->Special.BOOPSI.TagCurrent)
  384.                         {
  385.                             if(ThisTag = FindTagItem(Node->Special.BOOPSI.TagCurrent,TagList))
  386.                                 Node->Current = ThisTag->ti_Data;
  387.                         }
  388.  
  389.                         if(Node->Host)
  390.                             SetGadgetAttrsA(Node->Host,handle->Window,NULL,TagList);
  391.  
  392.                         return;
  393.                 }
  394.                 #endif    /* DO_BOOPSI_KIND */
  395.  
  396.                 #ifdef DO_TEXTEDIT_KIND
  397.                 {
  398.                     case TEXTEDIT_KIND:
  399.  
  400.                         if((ThisTag = FindTagItem(GA_Disabled,TagList)) != NULL)
  401.                             Node->Disabled = ThisTag->ti_Data;
  402.  
  403.                         if(ThisTag = FindTagItem(GTST_String,TagList))
  404.                         {
  405.                             if(Node->Host != NULL)
  406.                             {
  407.                                 SetGadgetAttrs(Node->Host,handle->Window,NULL,
  408.                                     STRINGA_Buffer,ThisTag->ti_Data,
  409.                                 TAG_DONE);
  410.                             }
  411.                             else
  412.                             {
  413.                                 STRPTR string = (STRPTR)ThisTag->ti_Data;
  414.     
  415.                                 if(Node->Special.TextEdit.Backup != NULL)
  416.                                     LTP_Free(handle,Node->Special.TextEdit.Backup,strlen(Node->Special.TextEdit.Backup)+1);
  417.     
  418.                                 Node->Special.TextEdit.Backup = (STRPTR)LTP_Alloc(handle,strlen(string)+1);
  419.                                 if(Node->Special.TextEdit.Backup != NULL)
  420.                                 {
  421.                                     strcpy(Node->Special.TextEdit.Backup,string);
  422.         
  423.                                     Node->Special.TextEdit.String = Node->Special.TextEdit.Backup;
  424.                                 }
  425.                             }
  426.                         }
  427.  
  428.                         SetGadgetAttrsA(Node->Host,handle->Window,NULL,TagList);
  429.                         return;
  430.                 }
  431.                 #endif    /* DO_TEXTEDIT_KIND */
  432.  
  433.                 case STRING_KIND:
  434.                 case FRACTION_KIND:
  435.  
  436.                     if(ThisTag = FindTagItem(GTST_String,TagList))
  437.                     {
  438.                         Exclude = GTST_String;
  439.  
  440.                         if(Gadget)
  441.                         {
  442.                             STRPTR String;
  443.  
  444.                             String = (STRPTR)ThisTag->ti_Data;
  445.  
  446.                             if(Node->Type == FRACTION_KIND)
  447.                             {
  448.                                 UBYTE DecimalPoint;
  449.  
  450.                                 LTP_CopyFraction(Node->Special.String.RealString,String);
  451.                                 String = Node->Special.String.RealString;
  452.  
  453.                                 DecimalPoint = LTP_DecimalPoint[0];
  454.  
  455.                                 if(DecimalPoint != '.')
  456.                                 {
  457.                                     LONG i;
  458.  
  459.                                     for(i = 0 ; i < strlen(String) ; i++)
  460.                                     {
  461.                                         if(String[i] == '.')
  462.                                         {
  463.                                             String[i] = DecimalPoint;
  464.                                             break;
  465.                                         }
  466.                                     }
  467.                                 }
  468.                             }
  469.  
  470.                             GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  471.                                 GTST_String,String,
  472.                             TAG_DONE);
  473.                         }
  474.                         else
  475.                         {
  476.                             if(!Node->Special.String.Backup)
  477.                                 Node->Special.String.Backup = (STRPTR)LTP_Alloc(handle,Node->Special.String.MaxChars + 1);
  478.  
  479.                             if(Node->Special.String.Backup)
  480.                             {
  481.                                 if(ThisTag->ti_Data)
  482.                                     strcpy(Node->Special.String.Backup,(STRPTR)ThisTag->ti_Data);
  483.                                 else
  484.                                     Node->Special.String.Backup[0] = 0;
  485.  
  486.                                 Node->Special.String.String = Node->Special.String.Backup;
  487.                             }
  488.                         }
  489.                     }
  490.  
  491.                     if(Gadget)
  492.                     {
  493.                         if(ThisTag = FindTagItem(LAST_CursorPosition,TagList))
  494.                         {
  495.                             struct StringInfo    *StringInfo = Gadget->SpecialInfo;
  496.                             LONG                 Position,Len;
  497.  
  498.                             LTP_StripGadgets(handle,handle->List);
  499.  
  500.                             Position = (LONG)ThisTag->ti_Data;
  501.  
  502.                             Len = strlen(StringInfo->Buffer);
  503.  
  504.                             if(Position == -1)
  505.                                 Position = Len;
  506.                             else
  507.                             {
  508.                                 if(Position < 0)
  509.                                     Position = 0;
  510.                                 else
  511.                                 {
  512.                                     if(Position > Len)
  513.                                         Position = Len;
  514.                                 }
  515.                             }
  516.  
  517.                             StringInfo->BufferPos = Position;
  518.  
  519.                             LTP_AddAllAndRefreshThisGadget(handle,Gadget);
  520.                         }
  521.                     }
  522.  
  523.                     break;
  524.  
  525.                 #ifdef DO_LEVEL_KIND
  526.                 {
  527.                     case LEVEL_KIND:
  528.                     {
  529.                         LevelExtra    *Special    = &Node->Special.Level;
  530.                         LONG         Level        = Node->Current,
  531.                                      Min        = Node->Min,
  532.                                      Max        = Node->Max,
  533.                                      Plus        = Special->Plus;
  534.                         BOOL         ChangeIt    = FALSE;
  535.  
  536.                         if(ThisTag = FindTagItem(GA_Disabled,TagList))
  537.                         {
  538.                             if(Node->Disabled != ThisTag->ti_Data)
  539.                             {
  540.                                 Node->Disabled = ThisTag->ti_Data;
  541.  
  542.                                 ChangeIt = TRUE;
  543.                             }
  544.                         }
  545.  
  546.                         if(ThisTag = FindTagItem(LAVL_Level,TagList))
  547.                         {
  548.                             if((LONG)ThisTag->ti_Data != Level)
  549.                             {
  550.                                 Level = (LONG)ThisTag->ti_Data;
  551.  
  552.                                 ChangeIt = TRUE;
  553.                             }
  554.                         }
  555.  
  556.                         if(ThisTag = FindTagItem(LAVL_Min,TagList))
  557.                         {
  558.                             if((LONG)ThisTag->ti_Data != Min)
  559.                             {
  560.                                 Plus = Min = (LONG)ThisTag->ti_Data;
  561.  
  562.                                 ChangeIt = TRUE;
  563.                             }
  564.                         }
  565.  
  566.                         if(ThisTag = FindTagItem(LAVL_Max,TagList))
  567.                         {
  568.                             if((LONG)ThisTag->ti_Data != Max)
  569.                             {
  570.                                 Max = (LONG)ThisTag->ti_Data;
  571.  
  572.                                 ChangeIt = TRUE;
  573.                             }
  574.                         }
  575.  
  576.                         if(ThisTag = FindTagItem(LAVL_NumTicks,TagList))
  577.                         {
  578.                             WORD Value = (WORD)ThisTag->ti_Data;
  579.  
  580.                             if(Value != Node->Special.Level.Ticks)
  581.                             {
  582.                                 Node->Special.Level.NumTicks = Value;
  583.                                 ChangeIt = TRUE;
  584.                             }
  585.                         }
  586.  
  587.                         if(Max < Min)
  588.                         {
  589.                             Max = Min;
  590.                             ChangeIt = TRUE;
  591.                         }
  592.  
  593.                         if(Level > Max)
  594.                         {
  595.                             Level = Max;
  596.                             ChangeIt = TRUE;
  597.                         }
  598.  
  599.                         if(Level < Min)
  600.                         {
  601.                             Level = Min;
  602.                             ChangeIt = TRUE;
  603.                         }
  604.  
  605.                         if(ChangeIt)
  606.                         {
  607.                             Node->Current    = Level;
  608.                             Node->Min        = Min;
  609.                             Node->Max        = Max;
  610.                             Special->Plus    = Plus;
  611.  
  612.                             LTP_PutStorage(Node);
  613.  
  614.                             if(Gadget && handle->Window)
  615.                             {
  616.                                 LONG Current;
  617.  
  618.                                 if(Node->Special.Level.Freedom == FREEVERT)
  619.                                     Current = Node->Max - Node->Current;
  620.                                 else
  621.                                     Current = Node->Current;
  622.  
  623.                                 SetGadgetAttrs(Gadget,handle->Window,NULL,
  624.                                     GA_Disabled,    Node->Disabled,
  625.                                     SLA_Current,    Current        - Plus,
  626.                                     SLA_Max,        Node->Max    - Plus,
  627.                                     SLA_NumTicks,    Node->Special.Level.NumTicks,
  628.                                 TAG_DONE);
  629.  
  630.                                 LTP_LevelGadgetDrawLabel(handle,Node,FALSE);
  631.                             }
  632.                         }
  633.  
  634.                         break;
  635.                     }
  636.                 }
  637.                 #endif    /* DO_LEVEL_KIND */
  638.  
  639.                 case CHECKBOX_KIND:
  640.  
  641.                     if(ThisTag = FindTagItem(GTCB_Checked,TagList))
  642.                     {
  643.                         if((Node->Current && ThisTag->ti_Data) || (!Node->Current && !ThisTag->ti_Data))
  644.                             Exclude = GTCB_Checked;
  645.                         else
  646.                         {
  647.                             Node->Current = ThisTag->ti_Data;
  648.  
  649.                             LTP_PutStorage(Node);
  650.                         }
  651.                     }
  652.  
  653.                     break;
  654.  
  655.                 #ifdef DO_TAPEDECK_KIND
  656.                 {
  657.                     case TAPEDECK_KIND:
  658.  
  659.                         if(ThisTag = FindTagItem(LATD_Pressed,TagList))
  660.                         {
  661.                             if(Node->Current != ThisTag->ti_Data && Node->Special.TapeDeck.Toggle)
  662.                             {
  663.                                 Node->Current = ThisTag->ti_Data;
  664.  
  665.                                 LTP_FixState(handle,Node->Current,Gadget,GFLG_SELECTED);
  666.                             }
  667.                         }
  668.  
  669.                         break;
  670.                 }
  671.                 #endif    /* DO_TAPEDECK_KIND */
  672.  
  673.                 #ifdef DO_GAUGE_KIND
  674.                 {
  675.                     case GAUGE_KIND:
  676.                     {
  677.                         LONG Percent         = (LONG)Node->Current;
  678.                         BOOL NeedRefresh    = FALSE;
  679.                         BOOL FullRefresh    = FALSE;
  680.  
  681.                         if(ThisTag = FindTagItem(LAGA_Percent,TagList))
  682.                         {
  683.                             Percent = (LONG)ThisTag->ti_Data;
  684.  
  685.                             if(Percent < 0)
  686.                                 Percent = 0;
  687.                             else
  688.                             {
  689.                                 if(Percent > 100)
  690.                                     Percent = 100;
  691.                             }
  692.  
  693.                             if(Percent != (LONG)Node->Current)
  694.                                 NeedRefresh = TRUE;
  695.                         }
  696.  
  697.                         if(ThisTag = FindTagItem(LAGA_InfoText,TagList))
  698.                         {
  699.                             STRPTR SomeText = (STRPTR)ThisTag->ti_Data;
  700.  
  701.                             if(Node->Special.Gauge.InfoLength)
  702.                             {
  703.                                 LONG Len = strlen(SomeText);
  704.  
  705.                                 if(Len > Node->Special.Gauge.InfoLength)
  706.                                     Len = Node->Special.Gauge.InfoLength;
  707.  
  708.                                 CopyMem(SomeText,Node->Special.Gauge.InfoText,Len);
  709.  
  710.                                 Node->Special.Gauge.InfoText[Len] = 0;
  711.  
  712.                                 NeedRefresh = TRUE;
  713.                             }
  714.                         }
  715.  
  716.                         if(ThisTag = FindTagItem(GA_Disabled,TagList))
  717.                         {
  718.                             if(Node->Disabled != ThisTag->ti_Data)
  719.                             {
  720.                                 FullRefresh = Node->Disabled;
  721.                                 NeedRefresh = TRUE;
  722.  
  723.                                 Node->Disabled = ThisTag->ti_Data;
  724.                             }
  725.                         }
  726.  
  727.                         if(NeedRefresh && Gadget)
  728.                             LTP_DrawGauge(handle,Node,Percent,FullRefresh);
  729.                     }
  730.  
  731.                     return;
  732.                 }
  733.                 #endif
  734.  
  735.                 case LISTVIEW_KIND:
  736.  
  737.                     if(ThisTag = FindTagItem(GTLV_Labels,TagList))
  738.                     {
  739.                         Node->Special.List.Labels = (struct List *)ThisTag->ti_Data;
  740.  
  741.                         if(ThisTag->ti_Data == (ULONG)~0)
  742.                             Node->Min = Node->Max = -1;
  743.                         else
  744.                         {
  745.                             struct List    *List;
  746.                             LONG         Count = 0;
  747.                             struct Node    *Item;
  748.  
  749.                             if(ThisTag->ti_Data)
  750.                                 List = (struct List *)ThisTag->ti_Data;
  751.                             else
  752.                             {
  753.                                 STATIC const Tag Filter[2] = { GTLV_Labels,TAG_DONE };
  754.  
  755.                                 LONG Current = (LONG)GetTagData(GTLV_Selected,(ULONG)Node->Current,TagList);
  756.  
  757.                                 if(!NewTags)
  758.                                 {
  759.                                     if(!(NewTags = CloneTagItems(TagList)))
  760.                                         return;
  761.                                 }
  762.  
  763.                                 FilterTagItems(NewTags,(Tag *)Filter,TAGFILTER_NOT);
  764.  
  765.                                 List = (struct List *)<P_EmptyList;
  766.  
  767.                                 GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  768.                                     GTLV_Labels,    List,
  769.                                     GTLV_Selected,    Current,
  770.                                 TAG_DONE);
  771.  
  772.                                 Node->Special.List.Labels = List;
  773.  
  774.                                 DB(kprintf("GTLV_Labels: current = %ld\n",Current));
  775.                             }
  776.  
  777.                             SCANLIST(List,Item)
  778.                             {
  779.                                 Count++;
  780.                             }
  781.  
  782.                             Node->Min = 0;
  783.  
  784.                             if(Count)
  785.                                 Node->Max = Count - 1;
  786.                             else
  787.                                 Node->Max = 0;
  788.                         }
  789.                     }
  790.  
  791.                     if(ThisTag = FindTagItem(GTLV_Selected,TagList))
  792.                     {
  793.                         Node->Current = (LONG)ThisTag->ti_Data;
  794.  
  795.                         if(Gadget)
  796.                         {
  797.                             Exclude = GTLV_Selected;
  798.  
  799.                             GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  800.                                 GTLV_Selected,        Node->Current,
  801.                                 GTLV_Labels,        Node->Special.List.Labels,
  802.                             TAG_DONE);
  803.                         }
  804.  
  805.                         LTP_PutStorage(Node);
  806.  
  807.                         if(!LTP_NotifyPager(handle,Node->Special.List.AutoPageID,Node->Current))
  808.                             return;
  809.                     }
  810.  
  811.                     if(ThisTag = FindTagItem(LALV_Selected,TagList))
  812.                     {
  813.                         Node->Current = (LONG)ThisTag->ti_Data;
  814.  
  815.                         if(Gadget)
  816.                         {
  817.                             ULONG WhichTag;
  818.  
  819.                             if(V39)
  820.                                 WhichTag = GTLV_MakeVisible;
  821.                             else
  822.                                 WhichTag = GTLV_Top;
  823.  
  824.                             Exclude = LALV_Selected;
  825.  
  826.                             GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  827.                                 GTLV_Selected,        Node->Current,
  828.                                 GTLV_Labels,        Node->Special.List.Labels,
  829.  
  830.                                 (Node->Current < 0) ? TAG_DONE : TAG_IGNORE,0,
  831.  
  832.                                 WhichTag,            Node->Current,
  833.                             TAG_DONE);
  834.                         }
  835.  
  836.                         LTP_PutStorage(Node);
  837.  
  838.                         if(!LTP_NotifyPager(handle,Node->Special.List.AutoPageID,Node->Current))
  839.                             return;
  840.                     }
  841.  
  842.                     if(ThisTag = FindTagItem(GA_Disabled,TagList))
  843.                     {
  844.                         if(!V39)
  845.                         {
  846.                             if(!NewTags)
  847.                             {
  848.                                 if(!(NewTags = CloneTagItems(TagList)))
  849.                                     return;
  850.                             }
  851.  
  852.                             FilterTagItems(NewTags,(Tag *)Filter,TAGFILTER_NOT);
  853.                         }
  854.                     }
  855.  
  856.                     break;
  857.  
  858.                 case MX_KIND:
  859.  
  860.                     if(ThisTag = FindTagItem(GTMX_Active,TagList))
  861.                     {
  862.                         if(Node->Current == ThisTag->ti_Data)
  863.                             Exclude = GTMX_Active;
  864.                         else
  865.                         {
  866.                             Node->Current = ThisTag->ti_Data;
  867.  
  868.                             LTP_PutStorage(Node);
  869.  
  870.                             if(!LTP_NotifyPager(handle,Node->Special.Radio.AutoPageID,Node->Current))
  871.                                 return;
  872.                         }
  873.                     }
  874.  
  875.                     if(!V39)
  876.                     {
  877.                         if(FindTagItem(GA_Disabled,TagList))
  878.                         {
  879.                             if(!(NewTags = CloneTagItems(TagList)))
  880.                                 return;
  881.                             else
  882.                                 FilterTagItems(NewTags,(Tag *)Filter,TAGFILTER_NOT);
  883.                         }
  884.                     }
  885.  
  886.                     break;
  887.  
  888.                 case CYCLE_KIND:
  889.  
  890.                     if(ThisTag = FindTagItem(GTCY_Active,TagList))
  891.                     {
  892.                         if(Node->Current == (LONG)ThisTag->ti_Data)
  893.                             Exclude = GTCY_Active;
  894.                         else
  895.                         {
  896.                             Node->Current = (LONG)ThisTag->ti_Data;
  897.  
  898.                             LTP_PutStorage(Node);
  899.  
  900.                             if(!LTP_NotifyPager(handle,Node->Special.Cycle.AutoPageID,Node->Current))
  901.                                 return;
  902.                         }
  903.                     }
  904.  
  905.                     if(ThisTag = FindTagItem(GTCY_Labels,TagList))
  906.                     {
  907.                         STRPTR    *Strings;
  908.                         LONG     Count = 0;
  909.  
  910.                         if(Strings = (STRPTR *)ThisTag->ti_Data)
  911.                         {
  912.                             while(Strings[Count])
  913.                                 Count++;
  914.                         }
  915.  
  916.                         if(Count)
  917.                             Node->Max = Count - 1;
  918.                         else
  919.                             Node->Max = 0;
  920.                     }
  921.  
  922.                     break;
  923.  
  924.                 #ifdef DO_POPUP_KIND
  925.                 {
  926.                     case POPUP_KIND:
  927.                     {
  928.                         BOOL NewCurrent = FALSE,NewLabels = FALSE;
  929.  
  930.                         if(ThisTag = FindTagItem(GA_Disabled,TagList))
  931.                             Node->Disabled = ThisTag->ti_Data;
  932.  
  933.                         if(ThisTag = FindTagItem(LAPU_Labels,TagList))
  934.                         {
  935.                             STRPTR    *Strings;
  936.                             LONG     Count = 0;
  937.  
  938.                             if(Strings = (STRPTR *)ThisTag->ti_Data)
  939.                             {
  940.                                 while(Strings[Count])
  941.                                     Count++;
  942.                             }
  943.  
  944.                             if(Count)
  945.                                 Node->Max = Count - 1;
  946.                             else
  947.                                 Node->Max = 0;
  948.  
  949.                             Node->Special.Popup.Choices = (STRPTR *)ThisTag->ti_Data;
  950.  
  951.                             DB(kprintf("max: %ld\n",Node->Max));
  952.  
  953.                             NewLabels = TRUE;
  954.                         }
  955.  
  956.                         if(ThisTag = FindTagItem(LAPU_Active,TagList))
  957.                         {
  958.                             DB(kprintf("current: %ld tag: %ld\n",Node->Current,ThisTag->ti_Data));
  959.  
  960.                             if(Node->Current != ThisTag->ti_Data)
  961.                             {
  962.                                 Node->Current = ThisTag->ti_Data;
  963.  
  964.                                 LTP_PutStorage(Node);
  965.  
  966.                                 if(!LTP_NotifyPager(handle,Node->Special.Popup.AutoPageID,Node->Current))
  967.                                     return;
  968.  
  969.                                 NewCurrent = TRUE;
  970.                             }
  971.                         }
  972.  
  973.                         if(Node->Host)
  974.                         {
  975.                             SetGadgetAttrs(Node->Host,handle->Window,NULL,
  976.                                 NewCurrent ? PIA_Active : TAG_IGNORE,    Node->Current,
  977.                                 NewLabels ? PIA_Labels : TAG_IGNORE,    Node->Special.Popup.Choices,
  978.                             TAG_MORE,TagList);
  979.                         }
  980.  
  981.                         return;
  982.                     }
  983.                 }
  984.                 #endif
  985.  
  986.                 #ifdef DO_TAB_KIND
  987.                 {
  988.                     case TAB_KIND:
  989.                     {
  990.                         if(ThisTag = FindTagItem(GA_Disabled,TagList))
  991.                             Node->Disabled = ThisTag->ti_Data;
  992.  
  993.                         if(ThisTag = FindTagItem(LATB_Active,TagList))
  994.                         {
  995.                             DB(kprintf("current: %ld tag: %ld\n",Node->Current,ThisTag->ti_Data));
  996.  
  997.                             if(Node->Current != ThisTag->ti_Data)
  998.                             {
  999.                                 Node->Current = ThisTag->ti_Data;
  1000.  
  1001.                                 LTP_PutStorage(Node);
  1002.  
  1003.                                 if(!LTP_NotifyPager(handle,Node->Special.Tab.AutoPageID,Node->Current))
  1004.                                     return;
  1005.                                 else
  1006.                                 {
  1007.                                     if(Node->Host)
  1008.                                     {
  1009.                                         SetGadgetAttrs(Node->Host,handle->Window,NULL,
  1010.                                             TIA_Index,Node->Current,
  1011.                                         TAG_MORE,TagList);
  1012.                                     }
  1013.                                 }
  1014.                             }
  1015.                         }
  1016.  
  1017.                         return;
  1018.                     }
  1019.                 }
  1020.                 #endif
  1021.  
  1022.                 case PALETTE_KIND:
  1023.  
  1024.                     if(ThisTag = FindTagItem(GTPA_Color,TagList))
  1025.                     {
  1026.                         if(Node->Current == ThisTag->ti_Data)
  1027.                             Exclude = GTPA_Color;
  1028.                         else
  1029.                         {
  1030.                             Node->Current = ThisTag->ti_Data;
  1031.  
  1032.                             LTP_PutStorage(Node);
  1033.  
  1034.                             if(Node->Special.Palette.UsePicker)
  1035.                             {
  1036.                                 if(Gadget)
  1037.                                     LTP_DrawPalette(handle,Node);
  1038.  
  1039.                                 return;
  1040.                             }
  1041.                         }
  1042.                     }
  1043.  
  1044.                     break;
  1045.  
  1046.                 case INTEGER_KIND:
  1047.  
  1048.                     if(ThisTag = FindTagItem(GTIN_Number,TagList))
  1049.                     {
  1050.                         LONG num = ThisTag->ti_Data;
  1051.  
  1052.                         if(num < Node->Min)
  1053.                             num = Node->Min;
  1054.                         else
  1055.                         {
  1056.                             if(num > Node->Max)
  1057.                                 num = Node->Max;
  1058.                         }
  1059.  
  1060.                         if(Gadget)
  1061.                         {
  1062.                             #ifdef DO_HEXHOOK
  1063.                             {
  1064.                                 if(!Node->Special.Integer.EditHook || Node->Special.Integer.CustomHook)
  1065.                                 {
  1066.                                     UBYTE                 buffer[20];
  1067.                                     struct StringInfo    *stringInfo;
  1068.  
  1069.                                     SPrintf(buffer,"%ld",num);
  1070.  
  1071.                                     Exclude = GTIN_Number;
  1072.  
  1073.                                     GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1074.                                         GTST_String,    buffer,
  1075.                                         GTIN_Number,    num,
  1076.                                     TAG_DONE);
  1077.  
  1078.                                     stringInfo = (struct StringInfo *)Gadget->SpecialInfo;
  1079.  
  1080.                                     stringInfo->LongInt = num;
  1081.                                 }
  1082.                                 else
  1083.                                 {
  1084.                                     UBYTE                 buffer[40];
  1085.                                     struct StringInfo    *stringInfo;
  1086.                                     STRPTR                 Index;
  1087.                                     LONG                 Value,Number = num,
  1088.                                                          Scale,Sign;
  1089.  
  1090.                                     stringInfo = (struct StringInfo *)Gadget->SpecialInfo;
  1091.  
  1092.                                     Index = stringInfo->Buffer;
  1093.  
  1094.                                     while(*Index && *Index == ' ')
  1095.                                         Index++;
  1096.  
  1097.                                     switch(Index[0])
  1098.                                     {
  1099.                                         case '$':
  1100.  
  1101.                                             SPrintf(buffer,"$%lx",num);
  1102.                                             break;
  1103.  
  1104.                                         case '&':
  1105.  
  1106.                                             if(Number < 0)
  1107.                                             {
  1108.                                                 Sign = -1;
  1109.                                                 Number = -Number;
  1110.                                             }
  1111.                                             else
  1112.                                                 Sign = 1;
  1113.  
  1114.                                             for(Value = 0, Scale = 1 ; Number ; Number /= 8, Scale *= 10)
  1115.                                                 Value += (Number & 7) * Scale;
  1116.  
  1117.                                             SPrintf(buffer,"&%ld",(LONG)(Sign * Value));
  1118.                                             break;
  1119.  
  1120.                                         case '%':
  1121.  
  1122.                                             if(Number < 0)
  1123.                                             {
  1124.                                                 Sign = -1;
  1125.                                                 Number = -Number;
  1126.                                             }
  1127.                                             else
  1128.                                                 Sign = 1;
  1129.  
  1130.                                             for(Value = 0, Scale = 1 ; Number ; Number /= 2, Scale *= 10)
  1131.                                                 Value += (Number & 1) * Scale;
  1132.  
  1133.                                             SPrintf(buffer,"%%%ld",(LONG)(Sign * Value));
  1134.                                             break;
  1135.  
  1136.                                         case '0':
  1137.  
  1138.                                             if(Index[1] == 'x')
  1139.                                             {
  1140.                                                 SPrintf(buffer,"0x%lx",num);
  1141.                                                 break;
  1142.                                             }
  1143.  
  1144.                                             // Fall through to...
  1145.  
  1146.                                         default:
  1147.  
  1148.                                             SPrintf(buffer,"%ld",num);
  1149.                                             break;
  1150.                                     }
  1151.  
  1152.                                     Exclude = GTIN_Number;
  1153.  
  1154.                                     GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1155.                                         GTST_String,buffer,
  1156.                                     TAG_DONE);
  1157.  
  1158.                                     stringInfo->LongInt = num;
  1159.                                 }
  1160.                             }
  1161.                             #else
  1162.                             {
  1163.                                 GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1164.                                     GTIN_Number,num,
  1165.                                 TAG_DONE);
  1166.                             }
  1167.                             #endif
  1168.                         }
  1169.  
  1170.                         Node->Special.Integer.Number = num;
  1171.  
  1172.                         LTP_PutStorage(Node);
  1173.                     }
  1174.  
  1175.                     break;
  1176.  
  1177.                 case NUMBER_KIND:
  1178.  
  1179.                     if(ThisTag = FindTagItem(GTNM_Number,TagList))
  1180.                         Node->Special.Number.Number = ThisTag->ti_Data;
  1181.  
  1182.                     break;
  1183.  
  1184.                 case SLIDER_KIND:
  1185.  
  1186.                     if(ThisTag = FindTagItem(GTSL_Level,TagList))
  1187.                     {
  1188.                         if(Node->Current == ThisTag->ti_Data)
  1189.                             Exclude = GTSL_Level;
  1190.                         else
  1191.                         {
  1192.                             Node->Current = ThisTag->ti_Data;
  1193.  
  1194.                             LTP_PutStorage(Node);
  1195.                         }
  1196.                     }
  1197.  
  1198.                     if(ThisTag = FindTagItem(GTSL_Min,TagList))
  1199.                     {
  1200.                         Node->Min = ThisTag->ti_Data;
  1201.  
  1202.                         if(Node->Current < Node->Min)
  1203.                         {
  1204.                             Node->Current = Node->Min;
  1205.  
  1206.                             LTP_PutStorage(Node);
  1207.                         }
  1208.                     }
  1209.  
  1210.                     if(ThisTag = FindTagItem(GTSL_Max,TagList))
  1211.                     {
  1212.                         Node->Max = ThisTag->ti_Data;
  1213.  
  1214.                         if(Node->Current > Node->Max)
  1215.                         {
  1216.                             Node->Current = Node->Max;
  1217.  
  1218.                             LTP_PutStorage(Node);
  1219.                         }
  1220.                     }
  1221.  
  1222.                     break;
  1223.  
  1224.                 case SCROLLER_KIND:
  1225.  
  1226.                     if(ThisTag = FindTagItem(GTSC_Top,TagList))
  1227.                     {
  1228.                         if(Node->Current == ThisTag->ti_Data)
  1229.                             Exclude = GTSC_Top;
  1230.                         else
  1231.                         {
  1232.                             Node->Current = ThisTag->ti_Data;
  1233.  
  1234.                             LTP_PutStorage(Node);
  1235.                         }
  1236.                     }
  1237.  
  1238.                     if(ThisTag = FindTagItem(GTSC_Total,TagList))
  1239.                     {
  1240.                         Node->Max = ThisTag->ti_Data;
  1241.  
  1242.                         if(Node->Current > Node->Max)
  1243.                         {
  1244.                             Node->Current = Node->Max;
  1245.  
  1246.                             LTP_PutStorage(Node);
  1247.                         }
  1248.                     }
  1249.  
  1250.                     if(ThisTag = FindTagItem(GTSC_Visible,TagList))
  1251.                         Node->Special.Scroller.Visible = ThisTag->ti_Data;
  1252.  
  1253.                     break;
  1254.  
  1255.                 case BOX_KIND:
  1256.                 {
  1257.                     BOOL Visible;
  1258.  
  1259.                     if(Node->Special.Box.Parent)
  1260.                         Visible = Node->Special.Box.Parent->Special.Group.Visible;
  1261.                     else
  1262.                         Visible = FALSE;
  1263.  
  1264.                     if(ThisTag = FindTagItem(LABX_Text,TagList))
  1265.                     {
  1266.                         STRPTR    Text = (STRPTR)ThisTag->ti_Data;
  1267.                         LONG    Index;
  1268.  
  1269.                         Index = (LONG)GetTagData(LABX_Index,0,TagList);
  1270.  
  1271.                         if(Index >= 0 && Index < Node->Lines)
  1272.                         {
  1273.                             if(Node->Special.Box.ReserveSpace)
  1274.                             {
  1275.                                 LONG Len = strlen(Text);
  1276.  
  1277.                                 if(Len > Node->Special.Box.MaxSize)
  1278.                                     Len = Node->Special.Box.MaxSize;
  1279.  
  1280.                                 CopyMem(Text,Node->Special.Box.Lines[Index],Len);
  1281.  
  1282.                                 Node->Special.Box.Lines[Index][Len] = 0;
  1283.                             }
  1284.                             else
  1285.                                 Node->Special.Box.Lines[Index] = Text;
  1286.                         }
  1287.  
  1288.                         if(Visible)
  1289.                             LTP_PrintBoxLine(handle,Node,Index);
  1290.                     }
  1291.  
  1292.                     if(ThisTag = FindTagItem(LABX_Lines,TagList))
  1293.                     {
  1294.                         STRPTR    *Lines = (STRPTR *)ThisTag->ti_Data;
  1295.                         LONG     i;
  1296.  
  1297.                         if(Node->Special.Box.ReserveSpace)
  1298.                         {
  1299.                             LONG Len;
  1300.  
  1301.                             for(i = 0 ; i < Node->Lines ; i++)
  1302.                             {
  1303.                                 if(Lines[i])
  1304.                                 {
  1305.                                     Len = strlen(Lines[i]);
  1306.  
  1307.                                     if(Len > Node->Special.Box.MaxSize)
  1308.                                         Len = Node->Special.Box.MaxSize;
  1309.  
  1310.                                     CopyMem(Lines[i],Node->Special.Box.Lines[i],Len);
  1311.  
  1312.                                     Node->Special.Box.Lines[i][Len] = 0;
  1313.  
  1314.                                     if(Visible)
  1315.                                         LTP_PrintBoxLine(handle,Node,i);
  1316.                                 }
  1317.                                 else
  1318.                                     break;
  1319.                             }
  1320.                         }
  1321.                         else
  1322.                         {
  1323.                             for(i = 0 ; i < Node->Lines ; i++)
  1324.                             {
  1325.                                 if(Lines[i])
  1326.                                 {
  1327.                                     Node->Special.Box.Lines[i] = Lines[i];
  1328.  
  1329.                                     if(Visible)
  1330.                                         LTP_PrintBoxLine(handle,Node,i);
  1331.                                 }
  1332.                                 else
  1333.                                     break;
  1334.                             }
  1335.                         }
  1336.                     }
  1337.  
  1338.                     break;
  1339.                 }
  1340.  
  1341.                 case TEXT_KIND:
  1342.  
  1343.                     if(ThisTag = FindTagItem(GTTX_Text,TagList))
  1344.                     {
  1345.                         STRPTR text = (STRPTR)ThisTag->ti_Data;
  1346.  
  1347.                         if(!text)
  1348.                             text = "";
  1349.  
  1350.                         if(Node->Special.Text.CopyText)
  1351.                         {
  1352.                             LONG len;
  1353.  
  1354.                             if(Node->Special.Text.Text)
  1355.                                 len = strlen(Node->Special.Text.Text) + 1;
  1356.                             else
  1357.                                 len = 0;
  1358.  
  1359.                             if(len)
  1360.                                 LTP_Free(handle,Node->Special.Text.Text,len);
  1361.  
  1362.                             len = strlen(text);
  1363.  
  1364.                             if(Node->Special.Text.Text = LTP_Alloc(handle,len + 1))
  1365.                                 strcpy(Node->Special.Text.Text,text);
  1366.                         }
  1367.                         else
  1368.                             Node->Special.Text.Text = text;
  1369.                     }
  1370.  
  1371.                     if(ThisTag = FindTagItem(GTTX_FrontPen,TagList))
  1372.                         Node->Special.Text.FrontPen = (WORD)ThisTag->ti_Data;
  1373.  
  1374.                     if(ThisTag = FindTagItem(GTTX_BackPen,TagList))
  1375.                         Node->Special.Text.BackPen = (WORD)ThisTag->ti_Data;
  1376.  
  1377.                     break;
  1378.  
  1379.                 case GROUP_KIND:
  1380.  
  1381.                     if(Node->Special.Group.Paging)
  1382.                     {
  1383.                         if(ThisTag = FindTagItem(LAGR_ActivePage,TagList))
  1384.                         {
  1385.                             ObjectNode *node;
  1386.  
  1387.                             node = Node;
  1388.  
  1389.                             if(node->Type == GROUP_KIND)
  1390.                             {
  1391.                                 if(node->Special.Group.ActivePage != ThisTag->ti_Data)
  1392.                                 {
  1393.                                     LONG    Left    = node->Left,
  1394.                                             Top        = node->Top,
  1395.                                             Width    = node->Width,
  1396.                                             Height    = node->Height;
  1397.  
  1398.                                     if(node->Label || node->Special.Group.Frame || node->Special.Group.FrameType == FRAMETYPE_Label)
  1399.                                     {
  1400.                                         Left    += 4 + handle->GlyphWidth;
  1401.                                         Width    -= 2 * (4 + handle->GlyphWidth);
  1402.  
  1403.                                         if(node->Label)
  1404.                                         {
  1405.                                             Top        += handle->GlyphHeight;
  1406.                                             Height    -= handle->GlyphHeight + 3;
  1407.                                         }
  1408.                                         else
  1409.                                         {
  1410.                                             Top        += 2;
  1411.                                             Height    -= 5;
  1412.                                         }
  1413.                                     }
  1414.                                     else
  1415.                                     {
  1416.                                         if(node->Special.Group.FrameType == FRAMETYPE_Tab)
  1417.                                         {
  1418.                                             Width    -= 2 * 2;
  1419.                                             Left    += 2;
  1420.                                             Height    -= 1;
  1421.                                         }
  1422.                                     }
  1423.  
  1424.                                     node->Special.Group.ActivePage = ThisTag->ti_Data;
  1425.  
  1426.                                     LT_LockWindow(handle->Window);
  1427.  
  1428.                                     LTP_EraseBox(&handle->RPort,Left,Top,Width,Height);
  1429.  
  1430.                                     LT_RebuildTagList(handle,FALSE,NULL);
  1431.  
  1432.                                     LT_UnlockWindow(handle->Window);
  1433.                                 }
  1434.                             }
  1435.                         }
  1436.                     }
  1437.  
  1438.                     break;
  1439.             }
  1440.  
  1441.             if(ThisTag = FindTagItem(LA_LabelText,TagList))
  1442.                 Node->Label = (STRPTR)ThisTag->ti_Data;
  1443.  
  1444.             if(ThisTag = FindTagItem(LA_LabelID,TagList))
  1445.             {
  1446.                 if(handle->LocaleHook)
  1447.                     Node->Label = (STRPTR)CallHookPkt(handle->LocaleHook,handle,(APTR)ThisTag->ti_Data);
  1448.             }
  1449.  
  1450.             if(ThisTag = FindTagItem(GA_Disabled,TagList))
  1451.             {
  1452.                 if((Node->Disabled && ThisTag->ti_Data) || (!Node->Disabled && !ThisTag->ti_Data))
  1453.                 {
  1454.                     if(!NewTags)
  1455.                         NewTags = CloneTagItems(TagList);
  1456.  
  1457.                     if(NewTags)
  1458.                         FilterTagItems(NewTags,(Tag *)Filter,TAGFILTER_NOT);
  1459.                 }
  1460.                 else
  1461.                 {
  1462.                     Node->Disabled = ThisTag->ti_Data;
  1463.  
  1464.                     if(Gadget)
  1465.                     {
  1466.                         struct Gadget *gad;
  1467.  
  1468.                         switch(Node->Type)
  1469.                         {
  1470.                             case TEXT_KIND:
  1471.  
  1472.                                 gad = Node->Special.Text.Picker;
  1473.                                 break;
  1474.  
  1475.                             case STRING_KIND:
  1476.  
  1477.                                 gad = Node->Special.String.Picker;
  1478.                                 break;
  1479.  
  1480.                             case INTEGER_KIND:
  1481.  
  1482.                                 LTP_FixState(handle,Node->Disabled,Node->Special.Integer.LeftIncrementer,GFLG_DISABLED);
  1483.  
  1484.                                 gad = Node->Special.Integer.RightIncrementer;
  1485.                                 break;
  1486.  
  1487.                             case FRACTION_KIND:
  1488.  
  1489.                                 LTP_FixState(handle,Node->Disabled,Node->Special.String.LeftIncrementer,GFLG_DISABLED);
  1490.  
  1491.                                 gad = Node->Special.String.RightIncrementer;
  1492.                                 break;
  1493.  
  1494.                             case TAPEDECK_KIND:
  1495.  
  1496.                                 gad = Node->Host;
  1497.  
  1498.                                 Gadget = NULL;
  1499.  
  1500.                                 break;
  1501.  
  1502.                             case PALETTE_KIND:
  1503.  
  1504.                                 gad = Node->Special.Palette.Picker;
  1505.                                 break;
  1506.  
  1507.                             case BUTTON_KIND:
  1508.  
  1509.                                 if(Node->Special.Button.ButtonImage)
  1510.                                 {
  1511.                                     gad = Node->Host;
  1512.  
  1513.                                     Gadget = NULL;
  1514.  
  1515.                                     break;
  1516.                                 }
  1517.  
  1518.                                 // FALLS THROUGH TO
  1519.  
  1520.                             default:
  1521.  
  1522.                                 gad = NULL;
  1523.                                 break;
  1524.                         }
  1525.  
  1526.                         LTP_FixState(handle,Node->Disabled,gad,GFLG_DISABLED);
  1527.                     }
  1528.                 }
  1529.             }
  1530.  
  1531.             if(Exclude)
  1532.             {
  1533.                 Tag Filter[2];
  1534.  
  1535.                 Filter[0] = Exclude;
  1536.                 Filter[1] = TAG_DONE;
  1537.  
  1538.                 if(!NewTags)
  1539.                     NewTags = CloneTagItems(TagList);
  1540.  
  1541.                 if(NewTags)
  1542.                     FilterTagItems(NewTags,Filter,TAGFILTER_NOT);
  1543.             }
  1544.  
  1545.             if(Gadget)
  1546.             {
  1547.                 struct TagItem *tags = TagList;
  1548.  
  1549.                 if(NewTags)
  1550.                     tags = NewTags;
  1551.  
  1552.                 if(!V39 && Node->Disabled && Node->Type == SLIDER_KIND)
  1553.                 {
  1554.                     GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1555.                         GA_Disabled,    FALSE,
  1556.                     TAG_MORE,tags);
  1557.  
  1558.                     GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1559.                         GA_Disabled,    TRUE,
  1560.                     TAG_DONE);
  1561.                 }
  1562.                 else
  1563.                     GT_SetGadgetAttrsA(Gadget,handle->Window,NULL,tags);
  1564.             }
  1565.  
  1566.             if(LIKE_STRING_KIND(Node))
  1567.                 LTP_PutStorage(Node);
  1568.  
  1569.             FreeTagItems(NewTags);
  1570.         }
  1571.     }
  1572. }
  1573.